*! version 2.24 15May2023 by Mead Over, Center for Global Development
*! Companion program to be executed by the help file: grc1leg2.sthlp
program grc1leg2_examples
	version 13.1
	if (_caller() < 13.1)  version 12
	else		      version 13.1

	set more off
	`0'
	
	capture prog drop grc1leg2
end

program Msg
	di as txt
	di as txt "-> " as res `"`0'"'
end

program Xeq
	di as txt
	di as txt `"-> "' as res _asis `"`0'"'
	`0'
end

program define NewName
	args fn
	capture graph rename `fn' `fn'
	if _rc==0 {
		di as txt "{p 0 2 2}"
		di "Example cannot be run because a graph already in memory is named:"  ///
			_n "  {res:`fn'}."
		di as txt "Either drop this graph or simply click {stata graph drop _all}."  ///
			_n "Then start over with {stata graph drop _all}" _n
		di as err _n "graph -`fn'- already exists"
		error 110
	}
end

program setup
	graph drop _all
	capture sysuse auto2
	if _rc~=0 {
		Msg sysuse auto2
		di as err "no; data in memory would be lost"
		di as err "First {stata clear:clear} your memory before running these examples"
		exit
	}
	foreach name in  ///
		grby3 grby5   ///  Two -by- graphs
		grcomb3 grcomb5 grcomb4 grcomb8  ///  Four -combined- graphs
		panel0 panel1 panel2 panel3 ///  Four component panels
		grc3woxtob1 grc3 grc8pnl grc3labsize grc4dflt grc4pnl grcfromby grcfromcomb  ///
		grcy2tor1 grchide grchide2 grc3_dispopts grclcols grclcolsasis {
		
		NewName `name'
	}

	set more off
	Xeq sysuse auto2
	Xeq drop if missing(rep78)
	Xeq gen byte qual = 1*(rep78<3)+2*(rep78==3)+3*(rep78>=4)
	Xeq lab def qual 1 "Low Quality"  2  "Medium Quality"  3  "High Quality"
	Xeq lab value qual qual
	Xeq lab var qual "Quality: Mapping of rep78 into trichotomy"
	Xeq tab rep78 qual
end

program grby3dflt
*	NewName grby3dflt  //  These checks have been moved to -setup-
	Xeq twoway  ///
		(scatter mpg weight)  ///
		(lfit mpg weight ),  ///
			by(qual,  ///
				title("Ex. 1.0: Three panels, with legend at 6 o'clock")  ///
				subtitle("Use -twoway ..., without options") ///
			)  ///
		name(grby3dflt, replace)
end

program grby3
*	NewName grby3  //  These checks have been moved to -setup-
	set graph on
	Xeq twoway  ///
		(scatter mpg weight)  ///
		(lfit mpg weight ),  ///
			legend(col(1)) ///
			by(qual,  ///
				legend(pos(0) at(4))  ///
				title("Ex. 1.1: Three panels, with legend in a hole")  ///
				subtitle("Use -twoway ..., by()- with -at(4) pos(5)-") ///
			)  ///
		name(grby3, replace)
end

program grby5
*	NewName grby5
	set graph on
	Xeq twoway  ///
		(scatter mpg weight)  ///
		(lfit mpg weight ),  ///
			legend(col(1)) ///
			by(rep78,  ///
				legend(pos(0) at(6))  ///
				title("Ex. 1.2: Five panels, with legend in a hole")  ///
				subtitle("Use -twoway ..., by()- with -at(6) pos(0)-") ///
			)   ///
		name(grby5, replace)

end

program make4panels
*	NewName panel1
*	NewName panel2
*	NewName panel3
*	NewName panel0
	
	Xeq set graph off
	
	Xeq twoway  ///
		(scatter mpg weight if qual==1)  ///
		(lfit mpg weight if qual==1),  ///
			ytitle(Miles per gallon)  ///
			subtitle("Low Quality")  ///
			legend(col(1) off) ///  Hidden legend has one column
			name(panel1, replace)

	Xeq twoway  ///
		(scatter mpg weight if qual==2)  ///
		(lfit mpg weight if qual==2),  ///
			ytitle(Miles per gallon)  ///
			subtitle("Medium Quality")  ///
			legend(row(1) off) ///  Hidden legend has one row
			name(panel2, replace)

	Xeq twoway  ///
		(scatter mpg weight if qual==3)  ///
		(lfit mpg weight if qual==3),  ///
			ytitle(Miles per gallon)  ///
			subtitle("High Quality")  ///
			legend(col(1) ring(0) pos(3) xoffset(55) )  ///
			name(panel3, replace)

	Xeq twoway  ///
		(scatter mpg weight)  ///
		(lfit mpg weight),  ///
			ytitle(Miles per gallon)  ///
			subtitle("Entire sample")  ///
			legend(col(1) ring(0) pos(3) xoffset(40) )  ///
			name(panel0, replace)

	Xeq set graph on
	
	di as txt _n "*        List the named graphs now in memory"
	Xeq graph dir, memory // These named graphs are now in memory
	
end

program grcomb4
*	NewName grcomb4
	set graph on
	Xeq gr combine panel1 panel2 panel3 panel0,  ///
		xcommon ycommon  ///
		title("Ex. 2.0: Four panels, with legend at bottom")  ///
		subtitle("Without tedious edits, the combined legend is misplaced")  ///
		name(grcomb4, replace) 
	
end

program grcomb3
*	NewName grcomb3
	set graph on
	Xeq gr combine panel1 panel2 panel3,  ///
		xcommon ycommon ///
		title("Ex. 2.1: Three panels, with legend in a hole")  ///
		subtitle("Use -gr combine ... , having specified"  ///
			"-col(1) ring(0) pos(3) xoffset(55)- on -panel3-")  ///
		name(grcomb3, replace) 
	
end

program grcomb5
*	NewName grcomb5
	set graph on
	Xeq gr combine panel1 panel2 panel1 panel2 panel0,  ///
		xcommon ycommon  ///
		title("Ex. 2.2: Five panels, with legend in a hole")  ///
		subtitle("Use -gr combine ... , having specified"  ///
			"-ring(0) pos(5) xoffset(40)- on the last panel")  ///
		name(grcomb5, replace) 
	
end

program grcomb8
*	NewName grcomb8
	set graph on
	Xeq gr combine panel1 panel2 panel1 panel0 panel1 panel2 panel1 panel2,  ///
		xcommon ycommon holes(5)    ///
		title("Ex. 2.3: Eight panels, with legend in the middle")  ///
		subtitle("Use -gr combine ... , having specified"  ///
			"-ring(0) pos(3) xoffset(40)- on graph for the fourth panel")  ///
		name(grcomb8, replace) 

end

*	Example 3.0: Using grc1leg2 without options
program grc4dflt
*	NewName grc4dflt

	if "$grc1leg2_saving"~= "" {
		local saving saving(grc4dflt, replace $asis )
	}

	set graph on
	Xeq grc1leg2 panel0 panel1 panel2 panel3 ,  ///
		title("Ex. 3.0: Four panels")  ///
		subtitle("Use -grc1leg2- to borrow the legend from panel0")  ///
		name(grc4dflt, replace)  `saving'
		
end

*	Example 3.1: Using grc1leg2 to display three panels with their legend in a "hole"
program grc3woxtob1
*	NewName grc3woxtob1

	if "$grc1leg2_saving"~= "" {
		local saving saving(grc3woxtob1, replace $asis )
	}

	set graph on
	Xeq grc1leg2 panel1 panel2 panel3,  ///
		ring(0) pos(5)  ///
		title("Ex. 3.1: Three panels, with legend in a hole")  ///
		subtitle("Use -grc1leg2- with options -ring(0) pos(5)- " /// 
			"without the option -xtob1title-")  ///
		name(grc3woxtob1, replace)  `saving'
		
end

*	Example 3.2: Using grc1leg2 to offset the combined legend
*		Saved file does NOT match displayed file (offset is undone)  FIXED
program grc3_offset
*	NewName grc3woxtob1
	if "$grc1leg2_saving"~= "" {
		local saving saving(grc3_offset, replace $asis)
	}

	set graph on
	Xeq grc1leg2 panel1 panel2 panel3,  ///
		xcommon ycommon ring(0) pos(5)  ///
		lxoffset(-20) lyoffset(17)  ///
		title("Ex. 3.2: Three panels, with legend in a hole")  ///
		subtitle("Use -grc1leg2- with options -ring(0) pos(5)- " /// 
			 "fine-tuned with legend offset options")  ///
		name(grc3_offset, replace)   `saving' 
		
*	di as txt "To open and display the gph file from disk click {stata graph use grc3_offset_gph:here}."	


end

*	Example 3.3: Using grc1leg2 to suppress redundant axis titles
*		Previous issue: Titles were correctly moved, but legend offset is undone.  FIXED)
program grc3
*	NewName grc3
	if "$grc1leg2_saving"~= "" {
		local saving saving(grc3, replace $asis)
	}

	set graph on
	Xeq grc1leg2 panel1 panel2 panel3,  ///
		xcommon ycommon ring(0) pos(5)  ///
		lxoffset(-10) lyoffset(17)  ///
		title("Ex. 3.3: Three panels, with legend in a hole")  ///
		subtitle("Use -grc1leg2- with options -ring(0) pos(5)- " /// 
			"with the offset options plus -xtob1title- and -ytol1title-")  ///
		xtob1title ytol1title  ///
		name(grc3, replace)  `saving' 

*	di as txt "To open and display the gph file from disk click {stata graph use grc3_gph:here}."	

end

*	Example 3.3_bis: Using grc1leg2 to suppress redundant main, sub or note text,
*		moving it to the combined graph.
program grc3_bis
*	NewName grc3
	if "$grc1leg2_saving"~= "" {
		local saving saving(grc3_bis, replace $asis)
	}

	Xeq set graph off

	Xeq twoway  ///
		(scatter mpg weight if qual==1, yaxis(1))  ///
		(lfit mpg weight if qual==1),  ///
			title("Ex. 3.3_bis: Move main title and note to combined graph")  ///
			subtitle("Low Quality")  ///
			note("Source: Gibbon, Edward (1890) The Decline and Fall of the Roman Empire."  ///
				"              London: F. Warne and Co.")  ///
			ytitle(Miles per gallon)  ///
			legend(col(1) off) ///
			name(panel1_bis, replace)

	Xeq set graph on
	
	Xeq grc1leg2 panel1_bis panel2 panel3,  ///
		xcommon ycommon ring(0) pos(5)  ///
		lxoffset(-10) lyoffset(17)  ///
		xtob1title ytol1title maintotoptitle notetonote  ///
		name(grc3_bis, replace)  `saving' 

*	di as txt "To open and display the gph file from disk click {stata graph use grc3_gph:here}."	

end

*	Examples 3.4a, 3.4b: Using grc1leg2 to edit characteristics of legend elements
program grc3legscale
*	NewName grc3labsize
	if "$grc1leg2_saving"~= "" {
		local saving saving(grc3labsize, replace $asis)
	}

	set graph on
	Xeq grc1leg2 panel1 panel2 panel3,  ///
		xcommon ycommon ring(0) pos(5)  ///
		lxoffset(-6) lyoffset(14)  ///
		title("Ex. 3.4a: Three panels, with legend in a hole")  ///
		subtitle("Use -grc1leg2- with options -ring(0) pos(5)- " /// 
			"and with -legscale(*1.2) lmsize(*.8)-")  ///
		xtob1title ytol1title legscale(*1.2) lmsize(*.8)  ///
		name(grc3legscale, replace)  `saving' 

*	di as txt "To open and display the gph file from disk click {stata graph use grc3labsize_gph:here}."

end 

program grc3labsize
*	NewName grc3labsize
	if "$grc1leg2_saving"~= "" {
		local saving saving(grc3labsize, replace $asis)
	}

	set graph on
	Xeq grc1leg2 panel1 panel2 panel3,  ///
		xcommon ycommon ring(0) pos(5)  ///
		lxoffset(-6) lyoffset(14)  ///
		title("Ex. 3.4b: Three panels, with legend in a hole")  ///
		subtitle("Use -grc1leg2- with options -ring(0) pos(5)- " /// 
			"and with the offset and borrowed title options plus -labsize(large)-")  ///
		xtob1title ytol1title labsize(*1.2) symxsize(*1.2) ///
		name(grc3labsize, replace)  `saving' 

*	di as txt "To open and display the gph file from disk click {stata graph use grc3labsize_gph:here}."	

end

*	Example 3.5: Using grc1leg2 to put a legend in the middle of eight panels
*		Works: Saved file matches displayed file
program grc8pnl
*	NewName grc8pnl
	if "$grc1leg2_saving"~= "" {
		local saving saving(grc8pnl, replace $asis)
	}

	set graph on
	Xeq grc1leg2 panel1 panel2 panel3 panel2 panel3 panel2 panel3 panel2,  ///
		xcommon ycommon ring(0) pos(0) holes(5)  ///
		title("Ex. 3.5: Eight panels: with legend in middle")  ///
		subtitle("Use -grc1leg2- with options -ring(0) pos(0) holes(5)-  "  ///
			"with the options -xtob1title- and -ytol1title-")  ///
		xtob1title ytol1title  ///
		name(grc8pnl, replace) `saving' 

*	di as txt "To open and display the gph file from disk click {stata graph use grc8pnl_gph:here}."	

end
 
*	Example 3.6: Using grc1leg2 to put the legend below the -b1title-
program grc4pnl
*	NewName grc4pnl
	if "$grc1leg2_saving"~= "" {
		local saving saving(grc4pnl, replace)
	}

	set graph on
	Xeq grc1leg2 panel0 panel1 panel2 panel3 ,  ///
		xcommon ycommon ring(2) legendfrom(panel2) ///
		title("Ex. 3.6: Four panels: with legend at bottom")  ///
		subtitle("Use -grc1leg2- with option -ring(2)-  "  ///
			"with the options -xtob1title- and -ytol1title-")  ///
		xtob1title ytol1title  ///
		name(grc4pnl, replace) `saving' 

*	di as txt "To open and display the gph file from disk click {stata graph use grc4pnl_gph:here}."	

end

*	Example 3.7: Borrowing the legend from a graph created by -graph ..., by()-
program grcfromby
*	NewName grcfromby
	if "$grc1leg2_saving"~= "" {
		local saving saving(grcfromby, replace $asis)
	}

	set graph off
	cap gr des grby3
	if _rc>0 qui grby3
	cap gr des grcomb3
	if _rc>0 qui grcomb3
	set graph on
	Xeq grc1leg2 grby3 grcomb3,  ///
		title("Ex. 3.7: Relocating the legend from a by() graph")  ///
		altshrink  ///
		name(grcfromby, replace) `saving' 

*	di as txt "To open and display the gph file from disk click {stata graph use grcfromby_gph:here}."	

end
 
*	Example 3.8: Borrowing the legend from a graph created by -graph combine-
*		Saved file does NOT match displayed file.  FIXED IN VERSION 1.62
program grcfromcomb
*	NewName grcfromcomb
	if "$grc1leg2_saving"~= "" {
		local saving saving(grcfromcomb, replace $asis)
	}

	cap gr des grby3
	if _rc>0 qui grby3 
	cap gr des grcomb3
	if _rc>0 qui grcomb3
	set graph on
	Xeq grc1leg2 grcomb3 grby3,  ///
		title("Ex. 3.8: Relocating the legend from a combined graph")  ///
		altshrink  ///
		name(grcfromcomb, replace)  `saving' 

*	di as txt "To open and display the gph file from disk click {stata graph use grcfromcomb_gph:here}."	

end

*	Example 3.9: Relocating the titles on a second y-axis
*		Titles and legend are correctly moved, but -lcols1()- is undone
*		So move the legend(cols(1)) option to the -panel4- legend.
program grcy2tor1
*	NewName grcy2tor1
	if "$grc1leg2_saving"~= "" {
		local saving saving(grcy2tor1, replace $asis)
	}

	Xeq set graph off
	Xeq twoway  ///
		(scatter mpg weight if qual==1, yaxis(1))  ///
		(scatter length weight if qual==1, yaxis(2)),  ///
			subtitle("Low Quality")  ///
			ylabel(,angle(hor) axis(2))  ///
			legend(cols(1))  ///
			name(panel4, replace)
	
	Xeq twoway  ///
		(scatter mpg weight if qual==2, yaxis(1))  ///
		(scatter length weight if qual==2, yaxis(2)),  ///
			subtitle("Medium Quality")  ///
			ylabel(,angle(hor) axis(2))  ///
			name(panel5, replace)
	
	Xeq twoway  ///
		(scatter mpg weight if qual==3, yaxis(1))  ///
		(scatter length weight if qual==3, yaxis(2)),  ///
			subtitle("High Quality")  ///
			ylabel(,angle(hor) axis(2))  ///
			name(panel6, replace)
	Xeq set graph on
		
	Xeq grc1leg2 panel4 panel5 panel6,  ///
		title("Ex. 3.9: Relocating the title on yaxis(2)")  ///
		xtob1title ytol1title y2tor1title  ///
		pos(4) ring(0) lxoffset(-20) lyoffset(15)  ///
		name(grcy2tor1, replace)  `saving' 

*	di as txt "To open and display the gph file from disk click {stata graph use grcy2tor1_gph:here}."	

end

*	Example 3.10: Making a composite legend using the -hidelegendfrom- option 
*		Setting the columns(1) option on the component legend sidesteps 
*		the difficulty with saving the effects of options -lcols()- and -lrows()-
program grchide  
	if "$grc1leg2_saving"~= "" {
		local saving saving(grchide, replace $asis)
	}


	Xeq set graph off
	
	Xeq twoway  ///
		(scatter mpg weight, mcolor(blue)),  ///
			name(panel7, replace)
	
	Xeq twoway  ///
		(scatter length weight, mcolor(red)),  ///
			name(panel8, replace)
	
	Xeq twoway  ///
		(scatter price weight, mcolor(green))  ///
		(lfitci  price weight, lcolor(green)),  ///
			ytitle(Price)  ///
			name(panel9, replace)
	
	Xeq twoway  ///  This is the component graph from which we take the legend
		(scatter mpg weight, mcolor(blue))  ///
		(scatter length weight, mcolor(red))  ///
		(scatter price weight, mcolor(green))  ///
		(lfitci  price weight, lcolor(green)),  ///
			legend(colfirst cols(2) order(1 2 3 5 4) holes(3))  ///  <- Alternative to -grc1leg2-'s -lcols()- 
			name(panel10, replace)
			
	Xeq set graph on
	
	Xeq grc1leg2 panel7 panel8 panel9 panel10,  ///
		title("Ex. 3.10a: Assemble the legend keys from different panels"   ///
			"to construct the combined legend")  ///
		subtitle("Combining twoway graphs with different markers")  ///
		xtob1title legendfrom(panel10) hidelegendfrom  ///
		pos(4) ring(0) lyoffset(15)  ///
		name(grchide, replace)   `saving' 

*	di as txt "To open and display the gph file from disk click {stata graph use grchide_gph:here}."	

end 

program grchide2  
	if "$grc1leg2_saving"~= "" {
		local saving saving(grchide2, replace $asis)
	}

	Xeq set graph off

	//  The pie graph's legend has symbols.
	Xeq graph pie, over(qual) plabel(_all percent, format(%5.1f) size(vlarge))  ///
		name(pie_symbols, replace)

	//  The scatter plot's legend has markers.
	Xeq tw  (scatter price weight if qual==1, pstyle(p1pie) msym(Oh))  ///
		(scatter price weight if qual==2, pstyle(p2pie))  ///
		(scatter price weight if qual==3, pstyle(p3pie)),  ///
		name(sctr_markers, replace)
		
	//  The auxiliary graph needed for its legend has both symbols and markers 
	Xeq tw  (rarea price price weight if qual==1)  ///
		(rarea price price weight if qual==2)  ///
		(rarea price price weight if qual==3)   ///
		(scatter price weight if qual==1, pstyle(p1pie) msym(Oh))  ///
		(scatter price weight if qual==2, pstyle(p2pie))  ///
		(scatter price weight if qual==3, pstyle(p3pie)),  ///
		legend(  ///
			label(1 "Low Quality") ///
			label(2 "Medium Quality") ///
			label(3 "High Quality") ///
			label(4 "Low Quality") ///
			label(5 "Medium Quality") ///
			label(6 "High Quality") ///
			rows(2)  ///
		)  ///
		name(sym_and_mark, replace)

	Xeq set graph on
	
	Xeq grc1leg2 pie_symbols sctr_markers sym_and_mark,  ///
		title("Ex. 3.10b: Assemble the legend keys from different panels"   ///
			"to construct the combined legend")  ///
		subtitle("Combining graphs with and without markers")  ///
		legendfrom(sym_and_mark) hidelegendfrom  ///
		name(grchide2, replace) `saving'

*	di as txt "To open and display the gph file from disk click {stata graph use grchide2_gph:here}."	

end 

*	Example 3.11: Changing the overall look of a combined graph
*		Saved file does NOT match displayed file: FIXED
program grc3_dispopts
*	NewName grc3
	if "$grc1leg2_saving"~= "" {
		local saving saving(grc3_dispopts, replace $asis)
	}

	set graph on
	Xeq grc1leg2 panel1 panel2 panel3,  ///
		xcommon ycommon ring(0) pos(5)  ///
		lxoffset(-5) lyoffset(15)  ///
		xtob1title ytol1title  ///
		xsize(8) ysize(8) scheme(s1rcolor)  ///
		title("Ex. 3.11: is 3.3 with a different overall look")  ///
		subtitle("From the same component panels,"  ///
			"alter the overall look of the combined graph" /// 
			"using the xsize(), ysize() and scheme() options")  ///
		name(grc3_dispopts, replace)   `saving' 

*	di as txt "To open and display the gph file from disk click {stata graph use grc3_dispopts_gph:here}."	

end

*	Example 3.12: Change the legend's row and column arrangement
*		Show that saved "live" file does not preserve the changed arrangement.
program grclcols
*	NewName grclcols
	set graph on
	Xeq grc1leg2 panel7 panel8 panel9 panel10,  ///
		title("Ex. 3.12: Change the legend's row and column arrangement"  ///
		`"with lcols(1) and save to disk as a "live" gph file"')  ///
		xtob1title legendfrom(panel10) hidelegendfrom  ///
		pos(4) ring(0) lxoffset(-5) lyoffset(15) lcols(1) ///
		name(grclcols, replace) saving(grclcols, replace)

end

*	Example 3.13: Scale one marker and one symbol in the combined graph
*		Saved file matches displayed file for one marker AND/OR one symbol: 
program grclcolsasis
*	NewName grclcolsasis
	set graph on
	Xeq grc1leg2 panel7 panel8 panel9 panel10,  ///
		title("Ex. 3.13: Change the legend's row and column arrangement"  ///
		`"with lcols(1) and save to disk as an "asis" gph file"')  ///
		xtob1title legendfrom(panel10) hidelegendfrom  ///
		pos(4) ring(0) lxoffset(-5) lyoffset(15) lcols(1) ///
		name(grclcolsasis, replace) saving(grclcolsasis, replace asis)

end

*	Example 3.10_bis: Using a legend that is not "complete".  A "known issue".
program known1  
	if "$grc1leg2_saving"~= "" {
		local saving saving(grchide, replace $asis)
	}

	Xeq set graph off
	
	Xeq twoway  ///
		(scatter mpg weight, mcolor(blue)),  ///
			name(panel7, replace)
	
	Xeq twoway  ///
		(scatter length weight, mcolor(red)),  ///
			name(panel8, replace)
	
	Xeq twoway  ///
		(scatter price weight, mcolor(green))  ///
		(lfitci  price weight, lcolor(green)),  ///
			ytitle(Price)  ///
			name(panel9, replace)
	
	Xeq twoway  ///  This is the component graph from which we take the legend
		(scatter mpg weight, mcolor(blue))  ///
		(scatter length weight, mcolor(red))  ///
		(scatter price weight, mcolor(green))  ///
		(lfitci  price weight, lcolor(green)),  ///
			legend(colfirst cols(2) order(1 2 3 5) )   ///  <- Option order(orderinfo) excludes the fourth key
			name(panel10_bis, replace)
			
	Xeq set graph on
	
	Xeq grc1leg2 panel7 panel8 panel9 panel10_bis,  ///
		title("Ex. 3.10_bis: When the designated legend is not complete,"  ///
			"-grc1leg2- refuses to re-size the legend's markers.")  ///
		xtob1title legendfrom(panel10_bis) hidelegendfrom  ///
		pos(4) ring(0) lyoffset(15) lmsize(*2)  /// <--  markers are enlarged
		name(known1, replace) `saving' notrap

end


 
*	Version 1.0.0 by Mead Over 1Apr2016
*		Based on Stata's gr_example2.ado, version 1.4.4  27aug2014
*	V. 1.0.1 11Apr2016: Adds the program -grc3lsize-
*	V. 1.0.2 23Jan2021: Renames it -grc3labsize-, adds -set graph on- commands
*	V. 1.1	29Jan2021: Add the options xtsize, ytsize, mtsize and Example 3.6 (grc4pnl) 
*	V. 1.2	23Mar2021: Add the options xtsize, ytsize, mtsize and Example 3.6 (grc4pnl)
*	V. 1.3	26Mar2021: Add the program -grcy2tor1- to demonstrate reloaction of the y2-axis 
*	V. 1.5	4Apr2021: Demonstrate the option -lcols(1)- in -grchide-
*	V. 1.6  15Jun2021: Demo. added options for -gr display-
*	V. 2.0  3Mar2022: Substantial changes to work with revised -grc1leg2.sthlp-
*		In particular, the options -lcols()- and -lrows()- are moved to examples 12 and 13.
*		Examples 3.0, 3.4a and 3.4b are new.
*	V. 2.1  12Mar2022: Change panel9 to use -lfitci- and change Examples 3.10, 3.12 and 3.13.
*		Add Example 3.10_bis to demonstrate Known Issue #1.
*	V. 2.11 13Mar2022: Change Example 3.10_bis to specify that only *marker* resizing is disabled by an incomplete legend.
*	V. 2.20 15Jun2022: Add example 3.3_bis to show how a main title or a note can be suppressed or moved.
*	V. 2.21 15Nov2022: Add -graph drop _all- to the program -setup-
*	V. 2.22 1Dec2022: Add the example -grchide2- to Ex. 3.10
*	V. 2.24 1Dec2022: In Ex. 3.11, change to xsize(8), ysize(8)
